package com.jin.webvideo.config.filter.access.rule;

import com.jin.webvideo.base.util.CollectionsUtil;
import com.jin.webvideo.config.filter.access.handler.AccessHandler;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public abstract class MultiAccessRule implements AccessHandler.AccessRule {
    protected List<AccessHandler.AccessRule> rules;

    protected MultiAccessRule(AccessHandler.AccessRule... rules) {
        this.rules = CollectionsUtil.asList(rules);
    }
    public void addAccessRule(AccessHandler.AccessRule rule) {
        this.rules.add(rule);
    }

    public void addAccessRules(AccessHandler.AccessRule... rules) {
        CollectionsUtil.foreach(Arrays.asList(rules), this::addAccessRule);
    }
}
